//
// Created on 2024/8/25.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef ISSUETEST_ARKUI_TEXT_H
#define ISSUETEST_ARKUI_TEXT_H

#include "../node/arkui_common_node.h"

namespace NativeArkUI {
class NativeText : public ArkUICommonNode {
public:
    NativeText() : ArkUICommonNode(ARKUI_NODE_TEXT) {}
    NativeText(ArkUI_NodeType type) : ArkUICommonNode(type) {}
    /**
     * 设置Text内容
     */
    void SetText(const char *string) {
        ArkUI_AttributeItem item = {.string = string};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CONTENT, &item);
    }
    /**
     * 设置文字大小
     */
    void SetFontSize(float size) {
        ArkUI_NumberValue value[] = {{.f32 = size}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_FONT_SIZE, &item);
    }
    /**
     * 设置文字粗细
     */
    void SetFontWeight(ArkUI_FontWeight weight) {
        ArkUI_NumberValue value[] = {{.i32 = ARKUI_FONT_WEIGHT_BOLD}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_FONT_WEIGHT, &item);
    }
    /**
     * 设置文字颜色
     */
    void SetFontColor(uint32_t color) {
        ArkUI_NumberValue value[] = {{.u32 = color}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_FONT_COLOR, &item);
    }
    /**
     * 设置文字间距
     */
    void SetTextCase(float textCase) {
        ArkUI_NumberValue value[] = {{.f32 = textCase}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_CASE, &item);
    }
    /**
     * 设置文字水平对齐方式
     */
    void SetTextHorizontalAlign(ArkUI_TextAlignment textAlignment) {
        ArkUI_NumberValue value[] = {{.i32 = textAlignment}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_TEXT_ALIGN, &item);
    }
    /**
     * 设置文字垂直对齐方式
     */
    void SetTextVerticalAlign(ArkUI_Alignment alignment) {
        ArkUI_NumberValue value[] = {{.i32 = alignment}};
        ArkUI_AttributeItem item = {value, 1};
        arkUINativeNodeApi->setAttribute(nodeHandle, NODE_ALIGNMENT, &item);
    }
};
} // namespace NativeArkUI

#endif // ISSUETEST_ARKUI_TEXT_H
